package work_c;

import java.io.File;


public class Test {
    public static void main(String[] args) {

        File f1=new File("D:\\file\\itheima\\itcast\\ccc.text");
        removeFile(f1);
    }

    public static void removeFile(File dir) {
        if (dir.exists() && dir.isDirectory()) {
            File[] files = dir.listFiles();
            for (File f : files) {
                if (f.isFile()) {
                    f.delete();
                } else {
                    removeFile(f);
                }
                f.delete();
            }

        }
    }
}
